package com.humngyang.com.hmy.study.concurrency.myannoations.concurrencyTest;


import com.humngyang.com.hmy.study.concurrency.myannoations.ThreadSafe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.atomic.AtomicReference;

//线程安全的
@ThreadSafe
public class ConcurrencyAtomicReference {
        private static Logger log = LoggerFactory.getLogger(ConcurrencyAtomicReference.class);
        private static AtomicReference<Integer> count = new AtomicReference<>(0);



        public static void main(String[] args) {
                count.compareAndSet(0,2);
                count.compareAndSet(0,1);
                count.compareAndSet(1,2);
                count.compareAndSet(2,3);
                count.compareAndSet(4,6);
                log.info("count{}",count.get());
        }


}
